import axios from '../http';
import { HttpResponse } from '@/types/HttpResponse';
import { FlightInSearch } from '@/types/Flight';

//封装接口方法
export class FlightService {
  /**
   * @description 查询航班相关信息
   *
   * @return {HttpResponse} result
   */
  static async selectFlight(data: FlightInSearch): Promise<HttpResponse> {
    return axios('/selectFlights', {
      method: 'post',
      responseType: 'json',
      data: data,
    });
  }
  static async selectFlightsInList(data: {
    airportName: string;
    op: string;
  }): Promise<HttpResponse> {
    return axios('/selectFlightsInList', {
      method: 'post',
      responseType: 'json',
      data: data,
    });
  }
  static async selectSpecificFlightByDate(data: {
    flightId: string;
    departureDate: Date;
  }): Promise<HttpResponse> {
    return axios('/selectSpecificFlightByDate', {
      method: 'post',
      responseType: 'json',
      data: data,
    });
  }
}
